<template>
  <el-container>
    <el-header>
      <el-page-header
        :content="(data.name as any)"
        @click="back"
      ></el-page-header>
      <div class="do">
        <el-button type="primary" @click="exportJson">保存</el-button>
      </div>
    </el-header>
    <el-main v-if="data">
      <sc-workflow v-model="data.nodeConfig"></sc-workflow>
    </el-main>
  </el-container>
</template>

<script setup lang="ts">
import scWorkflow from '@/components/scWorkflow/index.vue';
import { useRoute, useRouter } from 'vue-router';
import { reactive, onMounted } from 'vue';
import processDefinitionApi from '@/api/flow/ProcessDefinition';

const route = useRoute();
const router = useRouter();
// const detail = JSON.parse(route.query.item as string);
//路由传参
let routeQuery = route.query;
let data = reactive({
  id: 1,
  name: routeQuery.flowDefinitionName,
  nodeConfig: {
    nodeName: '发起人',
    type: 0,
    nodeRoleList: [],
    childNode: {},
  },
});

/*
 */
const getallDatas = async () => {
  var res = await processDefinitionApi.getAllDatas.post(
    routeQuery.id as string
  );
  data = res.data;
};
const exportJson = () => {};

//返回上一级
const back = () => {
  router.back();
};
getallDatas();
//流程定义保存
const saveProcessDefinition = () => {};

// onMounted(async () => {
//   await getallDatas();
// });
</script>
